import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;


public class Leetcode2022 {
    public static void main(String[] args) {
        int[][] res = construct2DArray(new int[]{3}, 1, 2);
        for (int[] r : res) {
            System.out.println(Arrays.toString(r));
        }
    }

    public static int[][] construct2DArray(int[] original, int m, int n) {
        if (original.length != m * n) {
            return new int[0][0];
        }

        int[][] res = new int[m][n];
        for (int i = 0; i < m; i++) {
            System.arraycopy(original, i * n, res[i], 0, n);
        }

        return res;
    }
}
